/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tool;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.ResourceBundle;

/**
 *
 * @author DH
 */
public class DBUtilities {

    public static Connection createConnection() throws ClassNotFoundException, SQLException {
        ResourceBundle rb = ResourceBundle.getBundle("configuration.config");
        String user = rb.getString("user");
        String pass = rb.getString("pass");
        String driver = rb.getString("driver");
        String databaseName = rb.getString("databaseName");
        String conString = rb.getString("conString") + "DatabaseName=" + databaseName;
        // connect to driver manager
        Class.forName(driver);
        // create connection
        Connection con = DriverManager.getConnection(conString, user, pass);
        return con;
    }
}
